package user

import (
	"context"
	"go_fream/api/user"

	"github.com/gogf/gf/v2/net/ghttp"
)

// 定义控制器的结构体
type Controller struct{}

// 实例化方法
func New() *Controller {
	return &Controller{}
}

// func Handler(ctx context.Context, req *Request) (res *Response, err error)
func (c *Controller) Add(ctx context.Context, req *user.AddReq) (res *user.AddRes, err error) {
	res = &user.AddRes{
		Name: "张三",
		Age:  18,
	}
	return
}

func (c *Controller) Update(r *ghttp.Request) {
	r.Response.Writefln("更新用户")
}

func (c *Controller) Delete(r *ghttp.Request) {
	r.Response.Writefln("删除用户")
}

func (c *Controller) Get(r *ghttp.Request) {
	r.Response.Writefln("查询一个用户")
}
